package cn.kgc;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/**
 * @author wangyue
 * @version 1.0
 */
public class Demo3 {
    public static void main(String[] args) {
        //创建线程任务
        FutureTask<String> task = new FutureTask<>(
                new Callable<String>() {
                    @Override
                    public String call() throws Exception {
                        return Thread.currentThread().getName();
                    }
                }
        );
        //将任务放到线程中启动线程
        new Thread(task).start();
    }
}
